﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <script src="../scripts/boot.js" type="text/javascript"></script>
    <script src="../scripts/kindeditor/kindeditor-min.js" type="text/javascript"></script>
    <script src="../scripts/kindeditor/lang/zh_CN.js" type="text/javascript"></script>
    <link href="../scripts/kindeditor/themes/default/default.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript">
        $.ajax({
            url: "../data/system.aspx?method=310",
            async: false,
            success: function (text) {
                if (text == "no")
                    window.location = "../system/error.html";
                else if (text == "out") {
                    var loginWindow = parent.mini.get("loginWindow");
                    if (!loginWindow.visible)
                        loginWindow.show();
                    var tabs = parent.mini.get("mainTabs");
                    var tab = tabs.getTab("tab$310");
                    tabs.removeTab(tab);
                }
            }
        });
        var Type = [{ id: 14, text: '新闻资讯' }, { id: 13, text: '通知公告' }, { id: 15, text: '公务员事业单位招考' }, { id: 11, text: '市场快讯' }, { id: 12, text: '热点招聘'}];
        var States = [{ id: 0, text: '显示' }, { id: 1, text: '隐藏' }, { id: -1, text: '全部'}];
    </script>
</head>
<body>
    <div class="mini-toolbar" style="border-bottom: 0;">
        <table>
            <tr>
                <td>
                    标题：
                    <input class="mini-textbox" id="key" emptytext="关键字" />
                    状态：
                    <input id="state" class="mini-combobox" style="width: 60px;" data="States" value="0" />
                    <a class="mini-button" iconcls="icon-search" plain="true" onclick="search();">查询</a>
                </td>
            </tr>
            <tr>
                <td>
                    <a class="mini-button" iconcls="icon-add" plain="true" onclick="addRow();">新增</a>
                    <a class="mini-button" iconcls="icon-remove" plain="true" onclick="delRows()">删除</a>
                    <span class="separator"></span>
                    <a class="mini-button" iconcls="icon-unlock" plain="true" onclick="lockRows(0);">显示</a>
                    <a class="mini-button" iconcls="icon-lock" plain="true" onclick="lockRows(1)">隐藏</a>
                    <span class="separator"></span>
                    <a class="mini-button" iconcls="icon-tip" plain="true" onclick="redRows(1);">描红</a>
                    <a class="mini-button" iconcls="icon-undo" plain="true" onclick="redRows(0)">取消</a>
                    <span class="separator"></span>
                    <a class="mini-button" iconcls="icon-reload" plain="true" onclick="refreshRows(1);">刷新</a>
                    <a class="mini-button" iconcls="icon-undo" plain="true" onclick="refreshRows(0)">取消</a>
                </td>
            </tr>
        </table>
    </div>
    <div class="mini-fit" >
        <div id="datagrid1" class="mini-datagrid" style="width:100%;height:100%;" allowresize="true"
            idfield="id" multiselect="true" url="../data/system.aspx?method=GetNewsList" sizeList="[15,20,50,100]" pageSize="15">
            <div property="columns">
                <div type="checkcolumn">
                </div>
                <div cellCls="actionIcons" name="action" width="50px" headerAlign="center" align="center" renderer="onActionRenderer" cellStyle="padding:0;">操作</div>
                <div field="nw_title" headeralign="center" align="center" allowsort="true" renderer="onNameRenderer">
                    资讯标题</div>
                <div field="nw_type" width="80px" headeralign="center" align="center" allowsort="true" renderer="onTypeRenderer">
                    资讯类型</div>
                <div field="nw_count" width="70px" headeralign="center" align="center" renderer="onFileRenderer">上传文件数</div>
                <div field="nw_hits" width="100px" headeralign="center" align="center" allowsort="true">
                    点击数</div>
                <div field="nw_inserttime" width="120px" headeralign="center" align="center" allowsort="true" dateFormat="yyyy-MM-dd HH:mm:ss">
                    添加时间</div>
                <div field="su_login" width="50px" headeralign="center" align="center" allowsort="true">
                    添加人</div>
                <div field="nw_insertip" width="70px" headeralign="center" align="center" allowsort="true">
                    添加IP</div>
                <div field="nw_modifytime" width="120px" headeralign="center" align="center" allowsort="true" dateFormat="yyyy-MM-dd HH:mm:ss">
                    最后修改时间</div>
                <div field="modifylogin" width="60px" headeralign="center" align="center" allowsort="true">
                    最后修改人</div>
                <div field="nw_modifyip" width="70px" headeralign="center" align="center" allowsort="true">
                    最后修改IP</div>
            </div>
        </div>
    </div>
    <div id="editWindow" class="mini-window" title="资讯信息" style="width: 1050px; height:auto;" showmodal="true"
        allowresize="false" allowdrag="true" showFooter="true">
        <div id="editform" class="form">
            <input class="mini-hidden" name="nw_no" id="nw_no" />
            <table style="width: 100%; height: 100%;">
                <tr style="height: 20px">
                    <td class="tdtitle" style="width: 100px;">
                        <span class="red">*</span>标题：
                    </td>
                    <td class="tdtext">
                        <input name="nw_title" class="mini-textbox" style="width:680px;" required="true"/>
                    </td>
                </tr>
                <tr style="height: 20px">
                    <td class="tdtitle">
                        类别：
                    </td>
                    <td class="tdtext">
                        <input name="nw_type" class="mini-hidden" value="12"/>&nbsp;&nbsp;热点招聘
                        <input name="nw_hide" class="mini-checkbox" text="隐藏"/>&nbsp;
                        <input name="nw_red" class="mini-checkbox" text="描红"/>&nbsp;
                        <input name="nw_new" class="mini-checkbox" text="首页图片新闻"/>
                    </td>
                </tr>
                <tr style="height: 20px">
                    <td class="tdtitle">
                        引用地址：
                    </td>
                    <td class="tdtext">
                        <input name="nw_url" class="mini-textbox" vtype="url" style="width:680px;"/>
                    </td>
                </tr>
                <tr style="height: 20px">
                    <td class="tdtitle">
                        图片：
                    </td>
                    <td class="tdtext">
                        <input class="mini-hidden" name="nw_img" id="nw_img"/>
                        <span id="spanload" style="display:none;">已经上传，<a id="img" class="linelink" target="_blank">查看</a>&nbsp;&nbsp;<a class="mini-button" iconcls="icon-remove" onclick="onDelete">删除</a></span>&nbsp;&nbsp;<input type="button" id="uploadButton" value="上传"/>&nbsp;&nbsp;&nbsp;&nbsp;(310*225)
                    </td>
                </tr>
                <tr style="height: 20px">
                    <td class="tdtitle">
                        内容：
                    </td>
                    <td class="tdtext">
                        <textarea name="nw_content" style="width:940px;height:300px;visibility:hidden;" class="textarea"></textarea>
                    </td>
                </tr>
            </table>
        </div>
        <div property="footer" style="text-align:center;padding:5px;">
            <a class="mini-button" style="width:60px;" onclick="updateRow()">保存</a>
            <span style="display:inline-block;width:25px;"></span>
            <a class="mini-button" style="width:60px;" onclick="closewin()">关闭</a>
        </div>
    </div>
    <script type="text/javascript">
        $.ajaxSetup({
            contentType: "application/x-www-form-urlencoded;charset=utf-8",
            complete: function (XMLHttpRequest, textStatus) {
                if (XMLHttpRequest.responseText == "out") {
                    var loginWindow = parent.mini.get("loginWindow");
                    if (!loginWindow.visible)
                        loginWindow.show();
                }
            }
        });

        mini.parse();

        var editor;
        var uploadbutton;
        KindEditor.ready(function (K) {
            editor = K.create('textarea[name="nw_content"]', {
                allowFileManager: true
            });
        });

        var grid = mini.get("datagrid1");
        search();

        function search() {
            var key = mini.get("key").getValue();
            var state = mini.get("state").getValue();
            grid.load({ type: 12, key: key, state: state });
            grid.sortBy("nw_no", "desc");
        }

        function onNameRenderer(e) {
            var record = e.record;
            var s;
            if (record.nw_hide == 1) {
                if (record.nw_url != null && record.nw_url != "")
                    s = '<a class="linelink" target="_blank" href="' + record.nw_url + '"><font color="#9a9a9a">' + record.nw_title + '</font></a>';
                else
                    s = '<a class="linelink" target="_blank" href="../../Web/News/' + record.nw_no + '.html"><font color="#9a9a9a">' + record.nw_title + '</font></a>';
            }
            else if (record.nw_red != null && record.nw_red == 1) {
                if (record.nw_url != null && record.nw_url != "")
                    s = '<a class="linelink" target="_blank" href="' + record.nw_url + '"><font color="#ff3300">' + record.nw_title + '</font></a>';
                else
                    s = '<a class="linelink" target="_blank" href="../../Web/News/' + record.nw_no + '.html"><font color="#ff3300">' + record.nw_title + '</font></a>';
            }
            else {
                if (record.nw_url != null && record.nw_url != "")
                    s = '<a class="linelink" target="_blank" href="' + record.nw_url + '">' + record.nw_title + '</a>';
                else
                    s = '<a class="linelink" target="_blank" href="../../Web/News/' + record.nw_no + '.html">' + record.nw_title + '</a>';
            }
//            if (record.nw_orderid != null && record.nw_orderid > 0)
//                s = s + '<font color="#0088ff">[顶]</font>';
//            if (record.nw_hide != null && record.nw_hide == 1)
//                s = s + '<font color="#ff3300">[隐]</font>';
            if (record.nw_new != null && record.nw_new == 1)
                s = s + '<font color="#0088ff">[图]</font>';
            return s;
        }

        function addRow() {
            var form = new mini.Form("#editform");
            form.reset();
            form.loading();
            form.unmask();
            editor.html('');
            var win = mini.get("editWindow");
            win.setTitle("新增资讯<span class='red'>( 带 * 号的必须填写)</span>");
            if (!win.visible)
                win.show();
            if (uploadbutton == null) {
                uploadbutton = KindEditor.uploadbutton({
                    button: KindEditor('#uploadButton')[0],
                    fieldName: 'imgFile',
                    url: '../scripts/kindeditor/upload/upload_json.ashx?dir=image',
                    afterUpload: function (data) {
                        if (data.error == 0) {
                            $("#img").attr("href", data.url);
                            $(".ke-button").val("重新上传");
                            mini.get("nw_img").setValue(data.url);
                            $("#spanload").show();
                        } else
                            ShowMessage("系统提示", data.message, 2);
                    },
                    afterError: function (str) {
                        ShowMessage("系统提示", "上传失败！", 3);
                    }
                });
                uploadbutton.fileBox.change(function (e) {
                    uploadbutton.submit();
                });
            }
            else
                onDelete();
        }

        function editRow(row_uid) {
            var row = grid.getRowByUID(row_uid);
            if (row) {
                var win = mini.get("editWindow");
                var form = new mini.Form("#editform");
                form.clear();
                form.loading();
                $.ajax({
                    url: "../data/system.aspx?method=GetNews&id=" + row.nw_no,
                    success: function (text) {
                        form.unmask();
                        if (text == "out") {
                            win.hide();
                            var loginWindow = parent.mini.get("loginWindow");
                            if (!loginWindow.visible)
                                loginWindow.show();
                            return;
                        }
                        var o = mini.decode(text);
                        form.setData(o);
                        editor.html(row.nw_content);
                        win.setTitle("编辑资讯<span class='red'>( 带 * 号的必须填写)</span>");
                        win.show();
                        if (uploadbutton == null) {
                            uploadbutton = KindEditor.uploadbutton({
                                button: KindEditor('#uploadButton')[0],
                                fieldName: 'imgFile',
                                url: '../scripts/kindeditor/upload/upload_json.ashx?dir=image',
                                afterUpload: function (data) {
                                    if (data.error == 0) {
                                        $("#img").attr("href", data.url);
                                        $(".ke-button").val("重新上传");
                                        mini.get("nw_img").setValue(data.url);
                                        $("#spanload").show();
                                    } else
                                        ShowMessage("系统提示", data.message, 2);
                                },
                                afterError: function (str) {
                                    ShowMessage("系统提示", "上传失败！", 3);
                                }
                            });
                            uploadbutton.fileBox.change(function (e) {
                                uploadbutton.submit();
                            });
                        }
                        if (o.nw_img != null && o.nw_img != '') {
                            $("#img").attr("href", o.nw_img);
                            $(".ke-button").val("重新上传");
                            $("#spanload").show();
                        }
                        else
                            onDelete();
                    },
                    error: function () {
                        form.unmask();
                        ShowMessage("系统提示", "表单加载出错！", 3);
                    }
                });
            }
        }

        function updateRow() {
            var content = editor.html();
            var form = new mini.Form("#editform");
            form.validate();
            if (form.isValid() == false)
                return;
            var o = form.getData();
            var json = mini.encode(o);

            mini.mask({ el: document.body, cls: 'mini-mask-loading', html: '保存中，请稍后...' });
            $.ajax({
                url: "../data/system.aspx?method=SaveNews",
                data: { data: json, content: content },
                type: "post",
                success: function (ret) {
                    mini.unmask(document.body);
                    if (ret == "out") {
                        var loginWindow = parent.mini.get("loginWindow");
                        if (!loginWindow.visible)
                            loginWindow.show();
                        return;
                    }
                    var editWindow = mini.get("editWindow");
                    if (ret == 1) {
                        editWindow.hide();
                        ShowMessage("系统提示", "资讯保存成功！", 1);
                        grid.reload();
                        creatHtml();
                    }
                    else if (ret == 0) {
                        editWindow.hide();
                        ShowMessage("系统提示", "该资讯已不存在，请确认！", 2);
                        grid.reload();
                    }
                    else
                        ShowMessage("系统提示", "资讯保存失败！", 3);
                },
                error: function (XMLHttpRequest, textStatus, errorThrown) {
                    mini.unmask(document.body);
                    ShowMessage("系统提示", "资讯保存失败！", 3);
                }
            });
        }

        function delRow(row_uid) {
            var row = grid.getRowByUID(row_uid);
            if (row) {
                mini.confirm("确定删除此资讯吗？", "系统提示",
                    function (action) {
                        if (action == "ok") {
                            mini.mask({ el: document.body, cls: 'mini-mask-loading', html: '删除中，请稍后...' });
                            $.ajax({
                                url: "../data/system.aspx?method=DeleteNews",
                                type: "post",
                                data: { id: row.nw_no },
                                success: function (ret) {
                                    mini.unmask(document.body);
                                    if (ret == "out") {
                                        var loginWindow = parent.mini.get("loginWindow");
                                        if (!loginWindow.visible)
                                            loginWindow.show();
                                        return;
                                    }
                                    if (ret >= 0) {
                                        ShowMessage("系统提示", "资讯删除成功！", 1);
                                        grid.reload();
                                        creatHtml();
                                    }
                                    else
                                        ShowMessage("系统提示", "资讯删除失败！", 3);
                                },
                                error: function (XMLHttpRequest, textStatus, errorThrown) {
                                    mini.unmask(document.body);
                                    ShowMessage("系统提示", "资讯删除失败！", 3);
                                }
                            });
                        }
                    }
                );
            }
        }

        function delRows() {
            var rows = grid.getSelecteds();
            if (rows.length > 0) {
                mini.confirm("确定删除所选资讯吗？", "系统提示",
                    function (action) {
                        if (action == "ok") {
                            mini.mask({ el: document.body, cls: 'mini-mask-loading', html: '删除中，请稍后...' });
                            var ids = "";
                            for (var i = 0; i < rows.length; i++) {
                                ids += rows[i].nw_no + ',';
                            }

                            $.ajax({
                                url: "../data/system.aspx?method=DeleteNews",
                                type: "post",
                                data: { id: ids },
                                success: function (ret) {
                                    mini.unmask(document.body);
                                    if (ret == "out") {
                                        var loginWindow = parent.mini.get("loginWindow");
                                        if (!loginWindow.visible)
                                            loginWindow.show();
                                        return;
                                    }
                                    if (ret >= 0) {
                                        ShowMessage("系统提示", "资讯删除成功！", 1);
                                        grid.reload();
                                        creatHtml();
                                    }
                                    else
                                        ShowMessage("系统提示", "资讯删除失败！", 3);
                                },
                                error: function (XMLHttpRequest, textStatus, errorThrown) {
                                    mini.unmask(document.body);
                                    ShowMessage("系统提示", "资讯删除失败！", 3);
                                }
                            });
                        }
                    }
                );
            } else
                ShowMessage("系统提示", "请选择需要删除的资讯！", 2);
        }

        function lockRows(state) {
            var rows = grid.getSelecteds();
            var msg = "隐藏";
            if (state == 0)
                msg = "显示";
            if (rows.length > 0) {
                mini.confirm("确定" + msg + "所选资讯吗？", "系统提示",
                    function (action) {
                        if (action == "ok") {
                            mini.mask({ el: document.body, cls: 'mini-mask-loading', html: '操作中，请稍后...' });
                            var ids = "";
                            for (var i = 0; i < rows.length; i++) {
                                ids += rows[i].nw_no + ',';
                            }

                            $.ajax({
                                url: "../data/system.aspx?method=LockNews",
                                type: "post",
                                data: { id: ids, state: state },
                                success: function (ret) {
                                    mini.unmask(document.body);
                                    if (ret == "out") {
                                        var loginWindow = parent.mini.get("loginWindow");
                                        if (!loginWindow.visible)
                                            loginWindow.show();
                                        return;
                                    }
                                    if (ret >= 0) {
                                        ShowMessage("系统提示", "资讯" + msg + "成功！", 1);
                                        grid.reload();
                                        creatHtml();
                                    }
                                    else
                                        ShowMessage("系统提示", "资讯" + msg + "失败！", 3);
                                },
                                error: function (XMLHttpRequest, textStatus, errorThrown) {
                                    mini.unmask(document.body);
                                    ShowMessage("系统提示", "资讯" + msg + "失败！", 3);
                                }
                            });
                        }
                    }
                );
            } else
                ShowMessage("系统提示", "请选择需要" + msg + "的资讯！", 2);
        }

        function topRows(state) {
            var rows = grid.getSelecteds();
            var msg = "置顶";
            if (state == 0)
                msg = "取消置顶";
            if (rows.length > 0) {
                mini.confirm("确定" + msg + "所选资讯？", "系统提示",
                    function (action) {
                        if (action == "ok") {
                            mini.mask({ el: document.body, cls: 'mini-mask-loading', html: '操作中，请稍后...' });
                            var ids = "";
                            for (var i = 0; i < rows.length; i++) {
                                ids += rows[i].nw_no + ',';
                            }

                            $.ajax({
                                url: "../data/system.aspx?method=TopNews",
                                type: "post",
                                data: { id: ids, state: state },
                                success: function (ret) {
                                    mini.unmask(document.body);
                                    if (ret == "out") {
                                        var loginWindow = parent.mini.get("loginWindow");
                                        if (!loginWindow.visible)
                                            loginWindow.show();
                                        return;
                                    }
                                    if (ret >= 0) {
                                        ShowMessage("系统提示", "资讯" + msg + "成功！", 1);
                                        grid.reload();
                                        creatHtml();
                                    }
                                    else
                                        ShowMessage("系统提示", "资讯" + msg + "失败！", 3);
                                },
                                error: function (XMLHttpRequest, textStatus, errorThrown) {
                                    mini.unmask(document.body);
                                    ShowMessage("系统提示", "资讯" + msg + "失败！", 3);
                                }
                            });
                        }
                    }
                );
            }
            else
                ShowMessage("系统提示", "请选择需要" + msg + "的资讯！", 2);
        }

        function redRows(state) {
            var rows = grid.getSelecteds();
            var msg = "描红";
            if (state == 0)
                msg = "取消描红";
            if (rows.length > 0) {
                mini.confirm("确定" + msg + "所选资讯？", "系统提示",
                    function (action) {
                        if (action == "ok") {
                            mini.mask({ el: document.body, cls: 'mini-mask-loading', html: '操作中，请稍后...' });
                            var ids = "";
                            for (var i = 0; i < rows.length; i++) {
                                ids += rows[i].nw_no + ',';
                            }

                            $.ajax({
                                url: "../data/system.aspx?method=RedNews",
                                type: "post",
                                data: { id: ids, state: state },
                                success: function (ret) {
                                    mini.unmask(document.body);
                                    if (ret == "out") {
                                        var loginWindow = parent.mini.get("loginWindow");
                                        if (!loginWindow.visible)
                                            loginWindow.show();
                                        return;
                                    }
                                    if (ret >= 0) {
                                        ShowMessage("系统提示", "资讯" + msg + "成功！", 1);
                                        grid.reload();
                                        creatHtml();
                                    }
                                    else
                                        ShowMessage("系统提示", "资讯" + msg + "失败！", 3);
                                },
                                error: function (XMLHttpRequest, textStatus, errorThrown) {
                                    mini.unmask(document.body);
                                    ShowMessage("系统提示", "资讯" + msg + "失败！", 3);
                                }
                            });
                        }
                    }
                );
            }
            else
                ShowMessage("系统提示", "请选择需要" + msg + "的资讯！", 2);
        }

        function newRows(state) {
            var rows = grid.getSelecteds();
            var msg = "设置首页图片新闻";
            if (state == 0)
                msg = "取消首页图片新闻";
            if (rows.length > 0) {
                mini.confirm("确定" + msg + "所选资讯？", "系统提示",
                    function (action) {
                        if (action == "ok") {
                            var messageid = mini.loading("操作中，请稍后......", "系统提示");
                            var ids = "";
                            for (var i = 0; i < rows.length; i++) {
                                ids += rows[i].nw_no + ',';
                            }

                            $.ajax({
                                url: "../data/system.aspx?method=NewNews",
                                type: "post",
                                data: { id: ids, state: state },
                                success: function (ret) {
                                    mini.unmask(document.body);
                                    if (ret == "out") {
                                        var loginWindow = parent.mini.get("loginWindow");
                                        if (!loginWindow.visible)
                                            loginWindow.show();
                                        return;
                                    }
                                    if (ret >= 0) {
                                        ShowMessage("系统提示", "资讯" + msg + "成功！", 1);
                                        grid.reload();
                                        creatHtml();
                                    }
                                    else
                                        ShowMessage("系统提示", "资讯" + msg + "失败！", 3);
                                },
                                error: function (XMLHttpRequest, textStatus, errorThrown) {
                                    mini.unmask(document.body);
                                    ShowMessage("系统提示", "资讯" + msg + "失败！", 3);
                                }
                            });
                        }
                    }
                );
            }
            else
                ShowMessage("系统提示", "请选择需要" + msg + "的资讯！", 2);
        }

        function refreshRows(state) {
            var rows = grid.getSelecteds();
            var msg = "刷新";
            if (state == 0)
                msg = "取消刷新";
            if (rows.length > 0) {
                mini.confirm("确定" + msg + "所选资讯？", "系统提示",
                    function (action) {
                        if (action == "ok") {
                            mini.mask({ el: document.body, cls: 'mini-mask-loading', html: '操作中，请稍后...' });
                            var ids = "";
                            for (var i = 0; i < rows.length; i++) {
                                ids += rows[i].nw_no + ',';
                            }

                            $.ajax({
                                url: "../data/system.aspx?method=RefreshNews",
                                type: "post",
                                data: { id: ids, state: state },
                                success: function (ret) {
                                    mini.unmask(document.body);
                                    if (ret == "out") {
                                        var loginWindow = parent.mini.get("loginWindow");
                                        if (!loginWindow.visible)
                                            loginWindow.show();
                                        return;
                                    }
                                    if (ret >= 0) {
                                        ShowMessage("系统提示", "资讯" + msg + "成功！", 1);
                                        grid.reload();
                                        creatHtml();
                                    }
                                    else
                                        ShowMessage("系统提示", "资讯" + msg + "失败！", 3);
                                },
                                error: function (XMLHttpRequest, textStatus, errorThrown) {
                                    mini.unmask(document.body);
                                    ShowMessage("系统提示", "资讯" + msg + "失败！", 3);
                                }
                            });
                        }
                    }
                );
            }
            else
                ShowMessage("系统提示", "请选择需要" + msg + "的资讯！", 2);
        }

        function creatHtml() {
            mini.confirm("是否生成首页静态页面？", "系统提示",
                function (action) {
                    if (action == "ok") {
                        mini.mask({ el: document.body, cls: 'mini-mask-loading', html: '生成中，请稍后...' });
                        $.ajax({
                            url: "../data/system.aspx?method=CreateHtml",
                            type: "post",
                            data: { webset: webset },
                            success: function (ret) {
                                mini.unmask(document.body);
                                if (ret == "out") {
                                    var loginWindow = parent.mini.get("loginWindow");
                                    if (!loginWindow.visible)
                                        loginWindow.show();
                                    return;
                                }
                                if (ret == 1) {
                                    ShowMessage("系统提示", "静态页面生成成功！", 1);
                                }
                                else
                                    ShowMessage("系统提示", "静态页面生成失败！", 3);
                            },
                            error: function (XMLHttpRequest, textStatus, errorThrown) {
                                mini.unmask(document.body);
                                ShowMessage("系统提示", "静态页面生成失败！", 3);
                            }
                        });
                    }
                }
            );
        }

        function closewin() {
            var win = mini.get("editWindow");
            win.hide();
        }

        function onDelete() {
            $("#img").attr("href", "");
            mini.get("nw_img").setValue("");
            $(".ke-button").val("上传");
            $("#spanload").hide();
        }

        //上传文件数显示
        function onFileRenderer(e) {
            var s = e.value;
            if (e.value != null && e.value > 0)
                s = '<a class="linelink" title="详细" href="javascript:void(0);" onclick="fileRows(' + e.record._uid + ')">查看</a> (' + e.value + ')';
            return s;
        }

        //上传文件管理
        function fileRows(row_uid) {
            var row = grid.getRowByUID(row_uid);
            if (row) {
                var tabs = parent.mini.get("mainTabs");
                var tab = tabs.getTab("tab$310");
                tab.enabled = false;
                showPTab(row.nw_no);
            }
        }

        //打开上传文件管理Tab
        function showPTab(nw_no) {
            var tabs = parent.mini.get("mainTabs");
            var id = "tab$file" + nw_no;
            var tab = tabs.getTab(id);
            if (!tab) {
                tab = {};
                tab.name = id;
                tab.title = "上传文件查看";
                tab.showCloseButton = true;
                tab.url = "news/file.html?method=310&nwno=" + nw_no;
                tabs.addTab(tab);
            }
            tabs.activeTab(tab);
        }
    </script>
</body>
</html>